package cn.edu.nju.freshdelivery.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import cn.edu.nju.freshdelivery.dao.CommentDAO;
import cn.edu.nju.freshdelivery.model.Comment;
import cn.edu.nju.freshdelivery.model.Dish;
import cn.edu.nju.freshdelivery.service.CommentService;

@Component
public class CommentServiceImpl implements CommentService {
	private CommentDAO commentDAO;

	/* (non-Javadoc)
	 * @see cn.edu.nju.freshdelivery.service.impl.CommentService#getCommentDAO()
	 */
	public CommentDAO getCommentDAO() {
		return commentDAO;
	}

	/* (non-Javadoc)
	 * @see cn.edu.nju.freshdelivery.service.impl.CommentService#setCommentDAO(cn.edu.nju.freshdelivery.dao.CommentDAO)
	 */
	@Resource
	public void setCommentDAO(CommentDAO commentDAO) {
		this.commentDAO = commentDAO;
	}

	/* (non-Javadoc)
	 * @see cn.edu.nju.freshdelivery.service.impl.CommentService#add(cn.edu.nju.freshdelivery.model.Comment)
	 */
	public void add(Comment comment) {
		commentDAO.save(comment);
	}
	
	/* (non-Javadoc)
	 * @see cn.edu.nju.freshdelivery.service.impl.CommentService#findByDish(cn.edu.nju.freshdelivery.model.Dish)
	 */
	public List<Comment> findByDish(Dish dish) {
		return commentDAO.findByDish(dish);
	}

}
